package chapter1104;

public class HourlyEmployee extends Employee {
    private double salary;
    private int hours;

    public HourlyEmployee(String name, int birthdayMonth, double salary, int hours) {
        super(name, birthdayMonth);
        this.salary = salary;
        this.hours = hours;
    }

    @Override
    public double getSalary(int month) {
        if(hours <= 160)
            return super.getSalary(month) + hours*salary;
        else{
            return super.getSalary(month) + 160*salary + (hours-160)*salary*1.5;
        }
    }

    public void setHours(int hours) {
        this.hours = hours;
    }
}
